package com.gasstion.controller;

import com.gasstion.dao.OilDao;
import com.gasstion.dao.SupplierGoodsDao;
import com.gasstion.entity.Oil;
import com.gasstion.entity.SupplierGoods;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/sugoods")
@Scope("prototype")
public class SupplierGoodsController {
    @Autowired
    SupplierGoodsDao supplierGoodsDao;

    @RequestMapping("/query")
    @ResponseBody
    public List<SupplierGoods> query(int supplierId){
        return supplierGoodsDao.query(supplierId);
    }

    @RequestMapping("/update")
    @ResponseBody
    public List<SupplierGoods> query(SupplierGoods supplierGoods,int supplierId){
        supplierGoodsDao.update(supplierGoods);
        return supplierGoodsDao.query(supplierId);
    }
}
